/*********************************************************************
*                     SEGGER Microcontroller GmbH                    *
*        Solutions for real time microcontroller applications        *
**********************************************************************
*                                                                    *
*        (c) 1996 - 2021  SEGGER Microcontroller GmbH                *
*                                                                    *
*        Internet: www.segger.com    Support:  support@segger.com    *
*                                                                    *
**********************************************************************
----------------------------------------------------------------------
File        : ID_SCREEN_00_Slots.c
Purpose     : AppWizard managed file, function content could be changed
---------------------------END-OF-HEADER------------------------------
*/

#include <stdio.h>
#include <stdlib.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "startup.h"
#include "Application.h"
#include "GUI_Builder.h"
#include "../Generated/Resource.h"
#include "../Generated/ID_SCREEN_00.h"

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       cbID_SCREEN_00
*/
static char Select_Item = 1;
extern WM_Status_t WM_Status;
void cbID_SCREEN_00(WM_MESSAGE *pMsg)
{
    // GUI_USE_PARA(pMsg);
    int     KeyValue;
    my_hWin = pMsg ->hWin;
    GUI_HWIN tmp = WM_GetDialogItem(WM_GetDialogItem(WM_HBKWIN, ID_SCREEN_00), ID_IMAGE_02);
    switch (pMsg -> MsgId)
    {
    case WM_INIT_DIALOG:
        rt_kprintf("WM_InitDlog\r\n");
        break;
    case WM_PAINT:
        WM_SetWindowPos(tmp, 80, 225 + (Select_Item - 1) * 168, 320, 132);
        break;
    case WM_KEY_USER_DEAL:
        KeyValue = GUI_GetKey();
        switch (KeyValue)
        {
        case GUI_KEY_LEFT:
            Select_Item ++;
            if (Select_Item > 3)
                Select_Item = 1;
            WM_Paint(my_hWin);
            rt_kprintf("Left!!\r\n");
            break;
        case GUI_KEY_RIGHT:
            Select_Item --;
            if (Select_Item == 0)
                Select_Item = 3;
            WM_Paint(my_hWin);
            rt_kprintf("Right!!\r\n");
            break;
        case GUI_KEY_DOWN:
            rt_kprintf("Confime %d \r\n", Select_Item); 
            rt_kprintf( " Confime ESC ,Free Space %d ,Used Space %d\r\n",
                        GUI_ALLOC_GetNumFreeBytes(), GUI_ALLOC_GetNumUsedBytes()); 
            switch (Select_Item)
            {
            case 1:
                WM_Status.Current_Screen = ID_SCREEN_01;
                APPW_SetVarData(ID_VAR_OPM_SCREEN, 1);
                break;
            case 2:
                WM_Status.Current_Screen = ID_SCREEN_01;
                APPW_SetVarData(ID_VAR_OPM_SCREEN, 1);
                break;
            case 3:
                WM_Status.Current_Screen = ID_SCREEN_01;
                APPW_SetVarData(ID_VAR_OPM_SCREEN, 1);
                break;
            default:
                break;
            }
            break;
        default:
            rt_kprintf("key is cilck");
            break;
        }
        GUI_ClearKeyBuffer();
        rt_kprintf("key is cilck");
        break;
    default:
        break;
    }

}
/*********************************************************************
*
*       ID_SCREEN_00__WM_NOTIFICATION_VALUE_CHANGED
*/
void ID_SCREEN_00__WM_NOTIFICATION_VALUE_CHANGED(APPW_ACTION_ITEM *pAction, WM_HWIN hScreen, WM_MESSAGE *pMsg, int *pResult)
{
    GUI_USE_PARA(pAction);
    GUI_USE_PARA(hScreen);
    GUI_USE_PARA(pMsg);
    GUI_USE_PARA(pResult);
}

/*************************** End of file ****************************/

/*************************** End of file ****************************/
